import { Component } from '@angular/core';
import {  NavController, NavParams } from 'ionic-angular';
import { Api } from '../../providers/api-service';
import { NoticeService } from '../../providers/notice-service';

/**
 *
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-publish-challenge-ht-guanfang',
  templateUrl: 'publish-challenge-ht-guanfang.html',
})
export class PublishChallengeHtGuanfangPage {
  params;
  Message;
  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    public noticeSer: NoticeService,
    public api: Api
  ) {
    this.params = this.navParams.get("params");
  }

  ionViewDidLoad() {
    console.log('发布评论 PublishChallengeHtGuanfangPage');


  }




  /**
   * 发布评论
   */
  publish() {
    let Message = this.Message;
    if (!Message) {
      this.noticeSer.showNoticeByToast(1, "内容不能为空！！！");
    }
    let ConversationID = this.params.ID;
    this.api.postBody("V1/InsertEvaluate", {
      Message: Message,
      ObjID: ConversationID
    })
      .then(data => {
        if (data.Code == 0) {
          this.navCtrl.pop();
        }
      })
  }


}
